<!DOCTYPE html>
<html lang="zh_cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>{:lang('LOG IN')}</title>
    <link rel="stylesheet" href="__STATIC__/plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="__ADMIN__/css/login.css" />
    <link rel="stylesheet" href="__STATIC__/common/css/font.css" />
    <style type="text/css">
        
    </style>
</head>
<body class="beg-login-bg">
  <div class="headers">
    <div class="nav-user lang" >
        <a href="#" data-lang="en-us" data-href="{:U('user/register/changeLang')}" class="_changeLang"><span class="en-us"></span>English</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="#" data-lang="zh-tw" data-href="{:U('user/register/changeLang')}" class="_changeLang">中文</a>
    </div>
</div>
<div class="container login">
    <div class="content layui-login">
        <div class="layui-row">
            <div class="layui-login-right " style="position: relative;">
              <div class="layui-login-content">
                  <img src="__STATIC__/admin/images/login-bg.png" class="login-img">
              </div>
            </div>
            <!--left start-->
            <div class="layui-login-left">
                <form class="layui-form layui-form-pane fields" method="post">
                    <input type="hidden" name="captcha" value="0" id="_captcha" />
                    <div class="layui-form-item">
                        <div class="beg-login-icon fs1 login-logo">
                            <span class="icon cloud-title"><img src="__STATIC__/user/images/logox.png"></span>
                        </div>
                    </div>
                    <!-- <div class="layui-form-item layui-row" style="margin:20px 0 45px;padding:0 5px;">
                        <div class="layui-col-xs6">
                          <div class="grid-demo login-txt">
                              <a href="#">{:lang('LOG IN')}</a>
                          </div>
                        </div>
                        <div class="layui-col-xs6">
                          <div class="grid-demo login-txt" style="text-align: right;">
                          <a href="#">{:lang('Sign up')}</a></div>
                        </div>
                    </div> -->
                    <div class="layui-form-item layui-login-input">
                        
                        <input type="text" id="_email" name="email" lay-verify="required" autocomplete="off" placeholder="{:lang('E-mail address')}" value="" class="layui-input text">
                        <icon class="input-icon login-email"></icon>
                    </div>
                    <div class="layui-form-item layui-login-input" style="margin-top:25px;">
                        
                        <input type="password"  id="_password" name="password" lay-verify="required" autocomplete="off" placeholder="{:lang('Password')}" value="" class="layui-input text">
                         <icon class="input-icon login-password"></icon>
                         <icon class="eye-no" id="_eye"></icon>
                    </div>

                    <div class="layui-form-item" style="margin-top:30px;">
                        
                        <div id="captcha"></div>
                    </div>
                     <div class="layui-form-item" style="text-align: center;margin:50px 0 6px">
                        <button type="submit" class="btn-submit " id="lp-pom-button-13" lay-submit lay-filter="login" style="font-size: 24px"><span style="font-size: 18px;">●</span> {:lang('LOG IN')} <span style="font-size: 18px;">●</span></button>
                    </div>
                    <div class="layui-form-item" style="text-align: center;padding-right: 5px; color: #fff;font-size: 16px;padding-top: 2px;">
                        <span>{:lang('No account?')}</span> <a href="{:url('user/register/index')}" style="color: #fff;font-weight:600;">{:strtoupper(lang('Sign up'))}</a>
                    </div>
                    <div class="login-footer"><img src="{:lang('footer font img')}" width="100%;" /></div>
                </form>

            </div>
            <!--left end-->
        </div>
    </div>
</div>
<script src="__STATIC__/plugins/drag/js/jquery-1.11.0.min.js"></script>
{include file="common/footer"/}
<!-- <link rel="stylesheet" href="__STATIC__/plugins/drag/css/htmleaf-demo.css">
 --><!-- <script src="__STATIC__/plugins/drag/js/drag.js"></script> -->
<script src="https://cdn.dingxiang-inc.com/ctu-group/captcha-ui/index.js"></script>

<script>

    var lang = "{$lang == 'en-us' ? 'en' : ''}";
    layui.use('form',function(){
        var form = layui.form,$ = layui.jquery;
        //监听提交
        form.on('submit(login)', function(data){
            
            if($("#lp-pom-button-13").hasClass('disabled')){
                return false;
            }
            if($("#_captcha").val() != 1){
                layer.msg("{:lang('Drag to Verify')}", {icon: 2, anim: 6, time: 1000});
                return false;
            }
            loading =layer.load(1, {shade: [0.1,'#fff'] });//0.1透明度的白色背景
            $.post('{:U("index/index")}',data.field,function(res){
                layer.close(loading);
                if(res.code == 1){
                    layer.msg(res.msg, {icon: 1, time: 1000}, function(){
                        location.href = res.url;
                    });
                }else{
                    $('#captcha').val('');
                    layer.msg(res.msg, {icon: 2, anim: 6, time: 1000});
                    $('.captcha img').attr('src','{:captcha_src()}?id='+Math.random());
                }
            });
            return false;
        });
         $("._changeLang").click(function(){
             var loading = layer.load(1, {shade: [0.1, '#fff']});
             $.post($(this).data('href'),{lang:$(this).data('lang')},function(res){
                layer.close(loading);
                location.reload();
             })
        })
         $("body").on("click","#_eye",function(){
             if($(this).hasClass('eye-yes')){
                $(this).removeClass('eye-yes');
                $("#_password").attr('type','password');
             }else{
                $(this).addClass('eye-yes');
                $("#_password").attr('type','text');
             } 
             
         })
         
    });
    //$('#drag').drags({name:"{:lang('Drag to Verify')}",success:"{:lang('Verify Successful')}"});
    
          (function()
          {
            var cap = $('#captcha')
            var form = cap.parents('form')
            var myCaptcha = _dx.Captcha(cap[0],
            {
              appId: '17edd2cfdf668d1aa0385504d297c7f7',
              type: 'basic',
              style: 'inline',
              language: lang, // 语言为英语
              width: $("#_email").width()+30,
              customLanguage: {
                pass_by_server: "{:lang('Verify success')}" // <-- 滑块中的提示文案
              },
              success: function(token)
              {
                $("#_captcha").val(1);
                $("#lp-pom-button-13").removeClass('disabled');
              }
            })
            myCaptcha.on('ready', function () {
             $("#dx_captcha_basic_slider-img-normal_1").attr('src',"/static/admin/images/btn-left1.png?t=3444");
             $(".dx_captcha_basic_slider-img-active").attr('src',"/static/admin/images/btn-left1.png?t=5555");
              // console.log('captcha is ready!')
            })
            myCaptcha.on('dragEnd', function () {
             $("#dx_captcha_basic_slider-img-normal_1").attr('src',"/static/admin/images/btn-left1.png?t=5554");
             $(".dx_captcha_basic_slider-img-active").attr('src',"/static/admin/images/btn-left1.png?t=5555");
              // console.log('captcha is ready!')
            })
          })()
        
</script>
</body>
</html>